home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_emacs.idb / usr / freeware / info / ediff-1.z / ediff-1 (.txt)
GNU Info File  |  1998-10-27  |  48KB  |  848 lines

  1. This is Info file ../info/ediff, produced by Makeinfo-1.63 from the
  2. input file ediff.texi.
  3.    This file documents Ediff, a comprehensive visual interface to Unix
  4. diff and patch utilities.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8. File: ediff,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  9. * Menu:
  10. * Introduction::                About Ediff.
  11. * Major Entry Points::          How to use Ediff.
  12. * Commands::                    Ediff commands.
  13. * Registry of Ediff Sessions::  Keeping track of multiple Ediff sessions.
  14. * Session Groups::              Comparing and merging directories.
  15. * Remote and Compressed Files::  You may want to know about this.
  16. * Customization::               How to make Ediff work the way YOU want.
  17. * Credits::                     Thanks to those who helped.
  18. * Index::
  19. File: ediff,  Node: Introduction,  Next: Major Entry Points,  Prev: Top,  Up: Top
  20. Introduction
  21. ************
  22.    Ediff provides a convenient way for simultaneous browsing through
  23. the differences between a pair (or a triple) of files or buffers.  The
  24. files being compared, file-A, file-B, and file-C (if applicable) are
  25. shown in separate windows (side by side, one above the another, or in
  26. separate frames), and the differences are highlighted as you step
  27. through them.  You can also copy difference regions from one buffer to
  28. another (and recover old differences if you change your mind).
  29.    Another powerful feature is the ability to merge a pair of files
  30. into a third buffer. Merging with an ancestor file is also supported.
  31. Furthermore, Ediff is equipped with directory-level capabilities that
  32. allow the user to conveniently launch browsing or merging sessions on
  33. groups of files in two (or three) different directories.
  34.    In addition, Ediff can apply a patch to a file and then let you step
  35. though both files, the patched and the original one, simultaneously,
  36. difference-by-difference.  You can even apply a patch right out of a
  37. mail buffer, i.e., patches received by mail don't even have to be
  38. saved.  Since Ediff lets you copy differences between buffers, you can,
  39. in effect, apply patches selectively (i.e., you can copy a difference
  40. region from `file_orig' to `file', thereby undoing any particular patch
  41. that you don't like).
  42.    Ediff even understands multi-file patches and can apply them
  43. interactively!  (Ediff can recognize multi-file patches only if they
  44. are in the context or GNU unified format. All other patches are treated
  45. as 1-file patches. Ediff is [hopefully] using the same algorithm as
  46. patch to determine which files need to be patched.)
  47.    Ediff is aware of version control, which lets you compare files with
  48. their older versions. Ediff also works with remote and compressed
  49. files, automatically ftp'ing them over and uncompressing them.  *Note
  50. Remote and Compressed Files::, for details.
  51.    This package builds upon ideas borrowed from Emerge and several
  52. Ediff's functions are adaptations from Emerge.  Although Ediff subsumes
  53. Emerge, much of the functionality of Ediff is influenced by Emerge.
  54. The architecture and the interface are, of course, drastically
  55. different.
  56. File: ediff,  Node: Major Entry Points,  Next: Commands,  Prev: Introduction,  Up: Top
  57. Major Entry Points
  58. ******************
  59.    Ediff can be invoked interactively using the following functions,
  60. which can be run either from the minibuffer or from the menu bar. In
  61. the menu bar, all Ediff's entry points belong to three submenus of the
  62. Tools menu: Compare, Merge, and Apply Patch.
  63. `ediff-files'
  64. `ediff'
  65.      Compare two files.
  66. `ediff-buffers'
  67.      Compare two buffers.
  68. `ediff-files3'
  69. `ediff3'
  70.      Compare three files.
  71. `ediff-buffers3'
  72.      Compare three buffers.
  73. `edirs'
  74. `ediff-directories'
  75.      Compare files common to two directories.
  76. `edirs3'
  77. `ediff-directories3'
  78.      Compare files common to three directories.
  79. `edir-revisions'
  80. `ediff-directory-revisions'
  81.      Compare versions of files in a given directory. Ediff selects only
  82.      the files that are under version control.
  83. `edir-merge-revisions'
  84. `ediff-merge-directory-revisions'
  85.      Merge versions of files in a given directory. Ediff selects only
  86.      the files that are under version control.
  87. `edir-merge-revisions-with-ancestor'
  88. `ediff-merge-directory-revisions-with-ancestor'
  89.      Merge versions of files in a given directory using other versions
  90.      as ancestors. Ediff selects only the files that are under version
  91.      control.
  92. `ediff-windows-wordwise'
  93.      Compare windows word-by-word.
  94. `ediff-windows-linewise'
  95.      Compare windows line-by-line.
  96. `ediff-regions-wordwise'
  97.      Compare regions word-by-word.
  98. `ediff-regions-linewise'
  99.      Compare regions line-by-line.
  100. `ediff-revision'
  101.      Compare versions of the current buffer, if the buffer is visiting
  102.      a file under version control.
  103. `ediff-patch-file'
  104. `epatch'
  105.      Patch a file, then compare.
  106. `ediff-patch-buffer'
  107. `epatch-buffer'
  108.      Patch auffer, then compare.
  109. `ediff-merge-files'
  110. `ediff-merge'
  111.      Merge two files.
  112. `ediff-merge-files-with-ancestor'
  113. `ediff-merge-with-ancestor'
  114.      Like `ediff-merge', but with a third ancestor file.
  115. `ediff-merge-buffers'
  116.      Merge two buffers.
  117. `ediff-merge-buffers-with-ancestor'
  118.      Same but with ancestor.
  119. `edirs-merge'
  120. `ediff-merge-directories'
  121.      Merge files common to two directories.
  122. `edirs-merge-with-ancestor'
  123. `ediff-merge-directories-with-ancestor'
  124.      Same but using files in a third directory as ancestors.
  125. `ediff-merge-revisions'
  126.      Merge two versions of the file visited by the current buffer.
  127. `ediff-merge-revisions-with-ancestor'
  128.      Same but with ancestor.
  129. If you want Ediff to be loaded from the very beginning of your Emacs
  130. session, you should put this line in your `~/.emacs' file:
  131.      (require 'ediff)
  132. Otherwise, Ediff will be loaded automatically when you use one of the
  133. above functions, either directly or through the menus.
  134.    When the above functions are invoked, they prompt the user for the
  135. information they need--typically the files or buffers to compare or
  136. patch. Ediff tries to be smart about these prompts. For instance, in
  137. comparing/merging files, it will offer the visible buffers as defaults.
  138. In prompting for files, if the user enters a directory, the previously
  139. input file name will be appended to that directory. In addition, if the
  140. variable `ediff-use-last-dir' is not `nil', Ediff will offer previously
  141. entered directories as defaults (which will be maintained separately
  142. for each type of file, A, B, or C).
  143.    All the above functions use the POSIX `diff' program to find
  144. differences between two files.  They process the `diff' output and
  145. display it in a convenient form.  At present, Ediff understands only the
  146. plain output from diff.  Options such as `-c' are not supported, nor is
  147. the format produced by incompatible file comparison programs such as
  148. the VMS version of `diff'.
  149.    The functions `ediff-files', `ediff-buffers', `ediff-files3',
  150. `ediff-buffers3' first display the coarse, line-based difference
  151. regions, as reported by the `diff' program.  Since diff may report
  152. fairly large chunks of text as being different, even though the
  153. difference may be localized to just a few words or even to the white
  154. space or line breaks, Ediff further *refines* the regions to indicate
  155. which exact words differ.  If the only difference is in the white space
  156. and line breaks, Ediff says so.
  157.    On a color display, fine differences are highlighted with color; on a
  158. monochrome display, they are underlined.  *Note Highlighting Difference
  159. Regions::, for information on how to customize this.
  160.    The functions `ediff-windows-wordwise', `ediff-windows-linewise',
  161. `ediff-regions-wordwise' and `ediff-regions-linewise' do comparison on
  162. parts of existing Emacs buffers.  Since `ediff-windows-wordwise' and
  163. `ediff-regions-wordwise' are intended for relatively small segments of
  164. buffers, comparison is done on the basis of words rather than lines.
  165. No refinement is necessary in this case.  These commands are recommended
  166. only for relatively small regions (perhaps, up to 100 lines), because
  167. these functions have a relatively slow startup.
  168.    To compare large regions, use `ediff-regions-linewise'.  This
  169. command displays differences much like `ediff-files' and
  170. `ediff-buffers'.
  171.    The functions `ediff-patch-file' and `ediff-patch-buffer' apply a
  172. patch to a file or a buffer and then run Ediff on these buffers,
  173. displaying the difference regions.
  174.    The entry points `ediff-directories', `ediff-merge-directories',
  175. etc., provide a convenient interface for comparing and merging files in
  176. different directories. The user is presented with Dired-like interface
  177. from which one can run a group of related Ediff sessions.
  178.    For files under version control, `ediff-revisions' lets you compare
  179. the file visited by the current buffer to one of its checked-in
  180. versions.  You can also compare two checked-in versions of the visited
  181. file.  Moreover, the functions `ediff-directory-revisions',
  182. `ediff-merge-directory-revisions', etc., let you run a group of related
  183. Ediff sessions by taking a directory and comparing (or merging)
  184. versions of files in that directory.
  185. File: ediff,  Node: Commands,  Next: Registry of Ediff Sessions,  Prev: Major Entry Points,  Up: Top
  186. Commands
  187. ********
  188.    All Ediff commands are displayed in a quick help window, unless you
  189. type `?' to shrink the window to just one line.  You can redisplay the
  190. help window by typing `?' again.  In this section we comment only on
  191. the features that cannot be readily deduced from the quick help window.
  192. You can always type `E' in the control window to display this manual.
  193.    Many Ediff commands take numeric prefix arguments.  For instance, if
  194. you type a number, say 3, and then `j' (`ediff-jump-to-difference'),
  195. Ediff moves to the third difference region.   Typing 3 and then `a'
  196. (`ediff-diff-to-diff') copies the 3d difference region from buffer A to
  197. buffer B.  Typing `b' does copying in the opposite direction.  (In
  198. 3-way comparison mode, the commands for copying are `ab', `ba', `ca',
  199. etc.) Likewise, 4 followed by `ra' restores the 4th difference region
  200. in buffer A (if it was previously saved as a result of copying from,
  201. say, buffer B to A).
  202.    Some commands take negative prefix arguments as well.  For instance,
  203. typing `-' and then `j' will take Ediff to the last difference. Typing
  204. `-2' then `j' takes Ediff to to the penultimate difference region, etc.
  205.    Without the prefix argument, all commands operate on the current
  206. selected difference region.  You can select any difference region as
  207. the current one using other Ediff commands.
  208.    For some commands, the value of the prefix argument is immaterial.
  209. However, if supplied, the prefix argument modifies the command.  For
  210. instance, normally the commands `ga'/`gb'/`gc'
  211. (`ediff-jump-to-difference-at-point') causes Ediff to jump to the
  212. difference region that is closest to the point in a specified buffer
  213. (the buffer, A, B, or C, is specified by the last character of the
  214. command, i.e., for `gb', the specified buffer is B).  However, with a
  215. prefix argument, Ediff would position all these buffers around the area
  216. indicated by the current point in the specified buffer: if the point is
  217. inside a difference region, then the buffers will be positioned at this
  218. difference region. If the point is not in any difference region, then
  219. it is in an area where all buffers agree with each other. In this case,
  220. all buffers will be positioned so that they would display this area.
  221.    The total number of differences and the current difference number are
  222. always displayed in the mode line of the control window.
  223.    If, after making changes to buffers A, B, or C, you decide to save
  224. them, it is best to use `ediff-save-buffer', which is bound to `wa',
  225. `wb', and `wc' (`wa' will save buffer A, `wb' saves buffer B, etc.).
  226.    Typing `wd' saves the output from the `diff' utility to a file, so
  227. you can later refer to it. With prefix argument, this command saves the
  228. plain output from `diff' (see `ediff-diff-program' and
  229. `ediff-diff-options'). Without the argument, it saves customized `diff'
  230. output (see `ediff-custom-diff-program' and
  231. `ediff-custom-diff-options'), if it is available.
  232.    Instead of saving it, `diff' output can be *displayed* using the
  233. command `D'. Without the prefix argument, it displays the customized
  234. `diff' output of the session.  With the prefix argument, it displays
  235. the plain `diff' output If either of the `diff' outputs is unavailable
  236. (because it wasn't generated or the user killed the respective buffer),
  237. then Ediff will try to display the other `diff' output.  If none is
  238. available, a warning is issued.
  239.    The command `z' suspends the current ediff session. It hides the
  240. control buffer and the variants. The easiest way to resume a suspended
  241. Ediff session is through the registry of active sessions.  *Note
  242. Registry of Ediff Sessions::, for details.
  243.    The command `q' quits the current Ediff session. With a prefix
  244. argument, it will ask the user whether to delete the variant buffers.
  245.    The command `s' is used only for merging.  It shrinks window C (the
  246. merge window) to its minimal size, thereby exposing as much of buffers A
  247. and B as possible.  This command is intended only for temporary viewing;
  248. therefore, Ediff restores window C to its original size whenever it
  249. makes any other change in the window configuration.  Typing `s' again
  250. also restores the original size of window C.  However, recentering and
  251. jumping to a difference does not affect window C's size.
  252.    With a positive prefix argument, the command `s' makes the merge
  253. window, window C, slightly taller. With `-' or a negative prefix
  254. argument, `s' makes window C slightly shorter.
  255.    Another command used only for merging is `+'.  Its effect is to
  256. combine the current difference regions of buffers A and B and put the
  257. combination into the merge buffer. *Note Merging and diff3::,
  258. specifically, the variables `ediff-combine-diffs' and
  259. `ediff-combination-pattern'.
  260.    In merge mode, Ediff uses a default variant (one of the two files
  261. being merged) when it cannot decide which of the difference regions
  262. (that of buffer A or buffer B) should be copied into the merge buffer.
  263. You might decide to use the other variant instead.  To facilitate this,
  264. Ediff has a command, bound to `&', which selects another default
  265. variant for the current difference and subsequent differences.  You can
  266. specify as the new default any of `default-A', `default-B', or
  267. `combined'.  *Note Merging and diff3::, for details.
  268.    Such repeated merging affects only difference regions that have
  269. default-A/B status, and only if they were not changed with respect to
  270. their originals.
  271.    Some commands are not bound to any key:
  272. `eregistry'
  273. `ediff-show-registry'
  274.      This command brings up the registry of active Ediff sessions.
  275.      Ediff registry is a useful device that can be used for resuming
  276.      Ediff sessions when the user switched to some other work before
  277.      finishing a comparison or merging job.  It is also useful for
  278.      switching between multiple active Ediff sessions that are run at
  279.      the same time. The function `eregistry' is an alias for
  280.      `ediff-show-registry'.
  281. `ediff-toggle-multiframe'
  282.      Changes the display from the multi-frame mode (where the quick
  283.      help window is in a separate frame) to the single-frame mode
  284.      (where all Ediff buffers share the same frame), and vice versa.
  285. `ediff-revert-buffers-then-recompute-diffs'
  286.      This command reverts the buffers you are comparing and recomputes
  287.      their differences.  It is useful when, after making changes, you
  288.      decided to make a fresh start, or if at some point you changed the
  289.      files being compared but want to discard any changes to comparison
  290.      buffers that were done since then.
  291.      This command normally asks for confirmation before reverting files.
  292.      With a prefix argument, it reverts files without asking.
  293. `ediff-profile'
  294.      Ediff has an admittedly primitive (but useful) facility for
  295.      profiling Ediff's commands.  It is meant for Ediff
  296.      maintenance--specifically, for making it run faster.  The function
  297.      `ediff-profile' toggles profiling of ediff commands.
  298. File: ediff,  Node: Registry of Ediff Sessions,  Next: Session Groups,  Prev: Commands,  Up: Top
  299. Registry of Ediff Sessions
  300. **************************
  301.    Ediff maintains a registry of all its invocations that are still
  302. *active*. This feature is very convenient for switching among active
  303. Ediff sessions or for quickly restarting a suspended Ediff session.
  304.    The focal point of this activity is a buffer called **Ediff
  305. Registry**. You can display this buffer by typing `R' in any Ediff
  306. Control Buffer or Session Group Buffer (*note Session Groups::.), or by
  307. typing `M-x eregistry' into the Minibuffer.  The latter would be the
  308. fastest way to bring up the registry buffer if no control or group
  309. buffer is displayed in any of the visible Emacs windows.  If you are in
  310. a habit of running multiple long Ediff sessions and often need to
  311. suspend, resume, or switch between them, it may be a good idea to have
  312. the registry buffer permanently displayed in a separate, dedicated
  313. window.
  314.    The registry buffer has several convenient key bindings.  For
  315. instance, clicking mouse button 2 or typing `RET' or `v' over any
  316. session record resumes that session.  Session records in the registry
  317. buffer provide a fairly complete description of each session, so it is
  318. usually easy to identify the right session to resume.
  319.    Other useful commands are bound to `SPC' (next registry record) and
  320. `DEL' (previous registry record). There are other commands as well, but
  321. you don't need to memorize them, since they are listed at the top of
  322. the registry buffer.
  323. File: ediff,  Node: Session Groups,  Next: Remote and Compressed Files,  Prev: Registry of Ediff Sessions,  Up: Top
  324. Session Groups
  325. **************
  326.    Several major entries of Ediff perform comparison and merging on
  327. directories.  On entering `ediff-directories', `ediff-directories3',
  328. `ediff-merge-directories', `ediff-merge-directories-with-ancestor',
  329. `ediff-directory-revisions', `ediff-merge-directory-revisions', or
  330. `ediff-merge-directory-revisions-with-ancestor', the user is presented
  331. with a Dired-like buffer that lists files common to the directories
  332. involved along with their sizes. (The list of common files can be
  333. further filtered through a regular expression, which the user is
  334. prompted for.) We call this buffer *Session Group Panel* because all
  335. Ediff sessions associated with the listed files will have this buffer
  336. as a common focal point.
  337.    Clicking button 2 or typing `RET' or `v' over a record describing
  338. files invokes Ediff in the appropriate mode on these files. You can
  339. come back to the session group buffer associated with a particular
  340. invocation of Ediff by typing `M' in Ediff control buffer of that
  341. invocation.
  342.    Many commands are available in the session group buffer; some are
  343. applicable only for certain types of work. The relevant commands are
  344. always listed at the top of each session group buffer, so there is no
  345. need to memorize them.
  346.    In directory comparison or merging, a session group panel displays
  347. only the files common to all directories involved. The differences are
  348. kept in a separate buffer and are conveniently displayed by typing `D'
  349. to the corresponding session group panel. Thus, as an added benefit,
  350. Ediff can be used to compare the contents of up to three directories.
  351.    Session records in session group panels are also marked with `+', for
  352. active sessions, and with `-', for finished sessions.
  353.    Sometimes, it is convenient to exclude certain session records from
  354. a group.  Usually this happens when the user doesn't intend to run
  355. Ediff of certain files in the group, and the corresponding session
  356. records just add clutter to the session group buffer. To help alleviate
  357. this problem, the user can type `h' to mark a session as a candidate
  358. for exclusion and `x' to actually hide the marked sessions. There
  359. actions are reversible: with a prefix argument, `h' unmarks the session
  360. under the cursor, and `x' brings the hidden sessions into the view (`x'
  361. doesn't unmark them, though, so the user has to explicitly unmark the
  362. sessions of interest).
  363.    Group sessions also understand the command `m', which marks sessions
  364. for future operations (other than hiding) on a group of sessions. At
  365. present, the only such group-level operation is the creation of a
  366. multi-file patch.
  367.    A multi-file patch is a concatenated output of several runs of the
  368. Unix `diff' command (some versions of `diff' let you create a
  369. multi-file patch in just one run).  In a session group buffer created in
  370. response to `ediff-directories' or `ediff-directory-revisions', the
  371. user can type `P' to create a multi-file patch of marked sessions
  372. (which must be marked using the `m' command).  Ediff then will display
  373. a buffer containing the patch.  In an `ediff-directories' session, it
  374. is enough to just mark the requisite sessions. In
  375. `ediff-directory-revisions' revisions, the marked sessions must also be
  376. active, or else Ediff will refuse to produce a multi-file patch. This is
  377. because, in the latter-style sessions, there are many ways to create
  378. diff output, and it is easier to handle by running Ediff on the inactive
  379. sessions.
  380. File: ediff,  Node: Remote and Compressed Files,  Next: Customization,  Prev: Session Groups,  Up: Top
  381. Remote and Compressed Files
  382. ***************************
  383.    Ediff works with remote, compressed, and encrypted files.  Ediff
  384. supports `ange-ftp.el', `jka-compr.el', `uncompress.el' and
  385. `crypt++.el', but it may work with other similar packages as well.
  386. This means that you can compare files residing on another machine, or
  387. you can apply a patch to a file on another machine.  Even the patch
  388. itself can be a remote file!
  389.    When patching compressed or remote files, Ediff does not rename the
  390. source file (unlike what the `patch' utility would usually do).
  391. Instead, the source file retains its name and the result of applying
  392. the patch is placed in a temporary file that has the suffix `_patched'
  393. attached.  Generally, this applies to files that are handled using
  394. black magic, such as special file handlers (ange-ftp and some
  395. compression and encryption packages all use this method).
  396.    Regular files are treated by the `patch' utility in the usual manner,
  397. i.e., the original is renamed into `source-name.orig' and the result of
  398. the patch is placed into the file source-name. (Ediff `_orig' on
  399. systems like VMS, DOS, etc.)
  400. File: ediff,  Node: Customization,  Next: Credits,  Prev: Remote and Compressed Files,  Up: Top
  401. Customization
  402. *************
  403.    Ediff has a rather self-explanatory interface, and in most cases you
  404. won't need to change anything.  However, should the need arise, there
  405. are extensive facilities to change the default behavior.
  406.    Most of the customization can be done by setting various variables
  407. in the `.emacs' file. Some customization (mostly window-related
  408. customization and faces) can be done by putting appropriate lines in
  409. `.Xdefaults', `.xrdb', or whatever X resource file is in use.
  410.    With respect to the latter, please note that the X resource for
  411. Ediff customization is `Ediff', *not* `emacs'.  *Note Window and Frame
  412. Configuration::, *Note Highlighting Difference Regions::, for further
  413. details. Please also refer to Emacs manual for the information on how
  414. to set Emacs X resources.
  415. * Menu:
  416. * Hooks::                       Customization via the hooks.
  417. * Quick Help::                  How to customize Ediff's quick help feature.
  418. * Window and Frame Configuration::  Controlling the way Ediff displays things.
  419. * Selective Browsing::          Advanced browsing through difference regions.
  420. * Highlighting Difference Regions::  Controlling highlighting.
  421. * Narrowing::                   Comparing regions, windows, etc.
  422. * Refinement of Difference Regions::  How to control the refinement process.
  423. * Patch and Diff Programs::     Changing the utilities that compute differences
  424.                                 and apply patches.
  425. * Merging and diff3::           How to customize Ediff in its Merge Mode.
  426. * Support for Version Control::  Changing the version control package.
  427.                                  You are not likely to do that.
  428. * Customizing the Mode Line::   Changing the look of the mode line in Ediff.
  429. * Miscellaneous::               Other customization.
  430. * Notes on Heavy-duty Customization::  Customization for the gurus.
  431. File: ediff,  Node: Hooks,  Next: Quick Help,  Prev: Customization,  Up: Customization
  432. Hooks
  433. =====
  434.    The bulk of customization can be done via the following hooks:
  435. `ediff-load-hook'
  436.      This hook can be used to change defaults after Ediff is loaded.
  437. `ediff-keymap-setup-hook'
  438.      This hook can be used to alter bindings in Ediff's keymap. These
  439.      hooks are run right after the default bindings are set but before
  440.      `ediff-load-hook'.  The regular user needs not be concerned with
  441.      this hook--it is provided for implementors of other Emacs packages
  442.      built on top of Ediff.
  443. `ediff-before-setup-windows-hook'
  444. `ediff-after-setup-windows-hook'
  445.      These two hooks are called before and after Ediff sets up its
  446.      window configuration.  Can be used to save the configuration that
  447.      existed before Ediff starts or for whatever other purposes.
  448. `ediff-suspend-hook'
  449. `ediff-quit-hook'
  450.      These two hooks are run when you suspend or quit Ediff.  They can
  451.      be used to set desired window configurations, delete files Ediff
  452.      didn't want to clean up after exiting, etc.
  453.      By default, `ediff-quit-hook' holds one hook function,
  454.      `ediff-cleanup-mess', which cleans after Ediff, as appropriate in
  455.      most cases.  You probably won't want to change it, but you might
  456.      want to add other hook functions.
  457.      Keep in mind that hooks executing before `ediff-cleanup-mess' start
  458.      in `ediff-control-buffer;' they should also leave
  459.      `ediff-control-buffer' as the current buffer when they finish.
  460.      Hooks that are executed after `ediff-cleanup-mess' should expect
  461.      the current buffer be either buffer A or buffer B.
  462.      `ediff-cleanup-mess' doesn't kill the buffers being compared or
  463.      merged (see `ediff-cleanup-hook', below).
  464. `ediff-cleanup-hook'
  465.      This hook is run just before `ediff-quit-hook'.  This is a good
  466.      place to do various cleanups, such as deleting the variant buffers.
  467.      Ediff provides a function, `ediff-janitor', as one such possible
  468.      hook, which you can add to `ediff-cleanup-hook' with `add-hooks'.
  469.      This function kills buffers A, B, and, possibly, C, if these
  470.      buffers aren't modified. In merge jobs, buffer C is never deleted.
  471.      However, the side effect of using this function is that you may
  472.      not be able to compare the same buffer in two separate Ediff
  473.      sessions: quitting one of them will delete this buffer in another
  474.      session as well.
  475. `ediff-before-setup-control-frame-hook'
  476. `ediff-after-setup-control-frame-hook'
  477.      These two hooks run before and after Ediff sets up the control
  478.      frame.  They can be used to relocate Ediff control frame when
  479.      Ediff runs in a multiframe mode (i.e., when the control buffer is
  480.      in its own dedicated frame).  Be aware that many variables that
  481.      drive Ediff are local to Ediff Control Panel
  482.      (`ediff-control-buffer'), which requires special care in writing
  483.      these hooks.  Take a look at `ediff-default-suspend-hook' and
  484.      `ediff-default-quit-hook' to see what's involved.
  485. `ediff-startup-hook'
  486.      This hook is run at the end of Ediff startup.
  487. `ediff-select-hook'
  488.      This hook is run after Ediff selects the next difference region.
  489. `ediff-unselect-hook'
  490.      This hook is run after Ediff unselects the current difference
  491.      region.
  492. `ediff-prepare-buffer-hook'
  493.      This hook is run for each Ediff buffer (A, B, C) right after the
  494.      buffer is arranged.
  495. `ediff-display-help-hook'
  496.      Ediff runs this hook each time after setting up the help message.
  497.      It can be used to alter the help message for custom packages that
  498.      run on top of Ediff.
  499. `ediff-mode-hook'
  500.      This hook is run just after Ediff mode is set up in the control
  501.      buffer. This is done before any Ediff window is created. You can
  502.      use it to set local variables that alter the look of the display.
  503. `ediff-registry-setup-hook'
  504.      Hooks run after setting up the registry for all active Ediff
  505.      session.  *Note Session Groups::, for details.
  506. `ediff-session-group-setup-hook'
  507.      Hooks run after setting up a control panel for a group of related
  508.      Ediff sessions. *Note Session Groups::, for details.
  509. File: ediff,  Node: Quick Help,  Next: Window and Frame Configuration,  Prev: Hooks,  Up: Customization
  510. Quick Help
  511. ==========
  512.    Ediff provides quick help using its control panel window. Since this
  513. window takes a fair share of the screen real estate, you can toggle it
  514. off by typing `?'.  The control window will then shrink to just one
  515. line and a mode line, displaying a short help message.
  516.    The variable `ediff-use-long-help-message' tells Ediff whether you
  517. use the short message or the long one.  By default, it is set to `nil',
  518. meaning that the short message is used.  Set this to `t', if you want
  519. Ediff to use the long message by default. This property can always be
  520. changed interactively, by typing `?' into Ediff Control Buffer.
  521.    If you want to change the appearance of the help message on a
  522. per-buffer basis, you must use `ediff-startup-hook' to change the value
  523. of the variable `ediff-help-message', which is local to
  524. `ediff-control-buffer'.
  525. File: ediff,  Node: Window and Frame Configuration,  Next: Selective Browsing,  Prev: Quick Help,  Up: Customization
  526. Window and Frame Configuration
  527. ==============================
  528.    On a non-windowing display, Ediff sets things up in one frame,
  529. splitting it between a small control window and the windows for buffers
  530. A, B, and C.  The split between these windows can be horizontal or
  531. vertical, which can be changed interactively by typing `|' while the
  532. cursor is in the control window.
  533.    On a window display, Ediff sets up a dedicated frame for Ediff
  534. Control Panel and then it chooses windows as follows: If one of the
  535. buffers is invisible, it is displayed in the currently selected frame.
  536. If a buffer is visible, it is displayed in the frame where it is
  537. visible.  If, according to the above criteria, the two buffers fall
  538. into the same frame, then so be it--the frame will be shared by the
  539. two.  The same algorithm works when you type `C-l' (`ediff-recenter'),
  540. `p' (`ediff-previous-difference'), `n' (`ediff-next-difference'), etc.
  541.    The above behavior also depends on whether the current frame is
  542. splittable, dedicated, etc. Unfortunately, the margin is too small to
  543. present this remarkable algorithm.
  544.    The bottom line of all this is that you can compare buffers in one
  545. frame or in different frames.  The former is done by default, while the
  546. latter can be achieved by arranging buffers A, B (and C, if applicable)
  547. to be seen in different frames.  Ediff respects these arrangements,
  548. automatically adapting itself to the multi-frame mode.
  549.    Ediff uses the following variables to set up its control panel
  550. (a.k.a. control buffer, a.k.a. quick help window):
  551. `ediff-control-frame-parameters'
  552.      You can change or augment this variable including the font, color,
  553.      etc.  The X resource name of Ediff Control Panel frames is
  554.      `Ediff'.  Under X-windows, you can use this name to set up
  555.      preferences in your `~/.Xdefaults', `~/.xrdb', or whatever X
  556.      resource file is in use. Usually this is preferable to changing
  557.      `ediff-control-frame-parameters' directly.  For instance, you can
  558.      specify in `~/.Xdefaults' the color of the control frame using the
  559.      resource `Ediff*background'.
  560.      In general, any X resource pertaining the control frame can be
  561.      reached via the prefix `Ediff*'.
  562. `ediff-control-frame-position-function'
  563.      The preferred way of specifying the position of the control frame
  564.      is by setting the variable `ediff-control-frame-position-function'
  565.      to an appropriate function.  The default value of this variable is
  566.      `ediff-make-frame-position'. This function places the control
  567.      frame in the vicinity of the North-East corner of the frame
  568.      displaying buffer A.
  569.    The following variables can be used to adjust the location produced
  570. by `ediff-make-frame-position' and for related customization.
  571. `ediff-narrow-control-frame-leftward-shift'
  572.      Specifies the number of characters for shifting the control frame
  573.      from the rightmost edge of frame A when the control frame is
  574.      displayed as a small window.
  575. `ediff-wide-control-frame-rightward-shift'
  576.      Specifies the rightward shift of the control frame from the left
  577.      edge of frame A when the control frame shows the full menu of
  578.      options.
  579. `ediff-control-frame-upward-shift'
  580.      Specifies the number of pixels for the upward shift of the control
  581.      frame.
  582. `ediff-prefer-iconified-control-frame'
  583.      If this variable is `t', the control frame becomes iconified
  584.      automatically when you toggle the quick help message off.  This
  585.      saves valuable real estate on the screen.  Toggling help back will
  586.      deiconify the control frame.
  587.      To start Ediff with an iconified Control Panel, you should set this
  588.      variable to `t' and `ediff-prefer-long-help-message' to `nil'
  589.      (*note Quick Help::.).  This behavior is useful only if the window
  590.      manager is TWM or a derivative. Also, this doesn't work under
  591.      XEmacs, since this editor ignores input from icons.
  592.    To make more creative changes in the way Ediff sets up windows, you
  593. can rewrite the function `ediff-setup-windows'.  However, we believe
  594. that detaching Ediff Control Panel from the rest and making it into a
  595. separate frame offers an important opportunity by allowing you to
  596. iconify that frame.  Under Emacs, the icon will usually accept all of
  597. the Ediff commands, but will free up valuable real estate on your screen
  598. (this may depend on the window manager, though).  Iconifying won't do
  599. any good under XEmacs since XEmacs icons are not sensitive to keyboard
  600. input.  The saving grace is that, even if not iconified, the control
  601. frame is very small, smaller than some icons, so it does not take much
  602. space in any case.
  603.    The following variable controls how windows are set up:
  604. `ediff-window-setup-function'
  605.      The multiframe setup is done by the
  606.      `ediff-setup-windows-multiframe' function, which is the default on
  607.      windowing displays.  The plain setup, one where all windows are
  608.      always in one frame, is done by `ediff-setup-windows-plain', which
  609.      is the default on a non-windowing display (or in an xterm window).
  610.      In fact, under Emacs, you can switch freely between these two
  611.      setups by executing the command `ediff-toggle-multiframe' using
  612.      the Minibuffer.
  613.      If you don't like any of these setups, write your own function.
  614.      See the documentation for `ediff-window-setup-function' for the
  615.      basic guidelines.  However, writing window setups is not easy, so
  616.      you should first take a close look at `ediff-setup-windows-plain'
  617.      and `ediff-setup-windows-multiframe'.
  618.    You can run multiple Ediff sessions at once, by invoking Ediff
  619. several times without exiting previous Ediff sessions.  Different
  620. sessions may even operate on the same pair of files.
  621.    Each session has its own Ediff Control Panel and all the regarding a
  622. particular session is local to the associated control panel buffer.  You
  623. can switch between sessions by suspending one session and then switching
  624. to another control panel.  (Different control panel buffers are
  625. distinguished by a numerical suffix, e.g., `Ediff Control Panel<3>'.)
  626. File: ediff,  Node: Selective Browsing,  Next: Highlighting Difference Regions,  Prev: Window and Frame Configuration,  Up: Customization
  627. Selective Browsing
  628. ==================
  629.    Sometimes it is convenient to be able to step through only some
  630. difference regions, those that satisfy certain regular expressions, and
  631. to ignore all others.  On other occasions, you may want to ignore
  632. difference regions that satisfy some regular expressions, and to look
  633. only at the rest.
  634.    The commands `#f' and `#h' let you do precisely this.
  635.    Typing `#f' lets you specify regular expressions that match
  636. difference regions you want to focus on.  We shall call these regular
  637. expressions REGEXP-A, REGEXP-B and REGEXP-C.  Ediff will then start
  638. stepping through only those difference regions where the region in
  639. buffer A matches REGEXP-A and/or the region in buffer B matches
  640. REGEXP-B, etc.  Whether `and' or `or' will be used depends on how you
  641. respond to a question.
  642.    When scanning difference regions for the aforesaid regular
  643. expressions, Ediff narrows the buffers to those regions. This means
  644. that you can use the expressions `\`' and `\'' to tie search to the
  645. beginning or end of the difference regions.
  646.    On the other hand, typing `#h' lets you specify (hide) uninteresting
  647. regions. That is, if a difference region in buffer A matches REGEXP-A,
  648. the corresponding region in buffer B matches REGEXP-B and (if
  649. applicable) buffer-C's region matches REGEXP-C, then the region will be
  650. ignored by the commands `n'/SPC (`ediff-next-difference') and `p'/DEL
  651. (`ediff-previous-difference') commands.
  652.    Typing `#f' and `#h' toggles selective browsing on and off.
  653.    Note that selective browsing affects only `ediff-next-difference'
  654. and `ediff-previous-difference', i.e., the commands `n'/SPC and
  655. `p'/DEL.  `#f' and `#h' do not change the position of the point in the
  656. buffers.  And you can still jump directly (using `j')  to any numbered
  657. difference.
  658.    Users can supply their own functions to specify how Ediff should do
  659. selective browsing. To change the default Ediff function, add a
  660. function to `ediff-load-hook' which will do the following assignments:
  661.      (setq ediff-hide-regexp-matches-function 'your-hide-function)
  662.      (setq ediff-focus-on-regexp-matches-function 'your-focus-function)
  663.    *Useful hint*: To specify a regexp that matches everything, don't
  664. simply type RET in response to a prompt. Typing RET tells Ediff to
  665. accept the default value, which may not be what you want. Instead, you
  666. should enter something like ^ or $. These match every line.
  667.    You can use the status command, `i', to find out whether selective
  668. browsing is currently in use.
  669.    The regular expressions you specified are kept in the local variables
  670. `ediff-regexp-focus-A', `ediff-regexp-focus-B', `ediff-regexp-focus-C',
  671. `ediff-regexp-hide-A', `ediff-regexp-hide-B', `ediff-regexp-hide-C'.
  672. Their default value is the empty string (i.e., nothing is hidden or
  673. focused on).  To change the default, set these variables in `.emacs'
  674. using `setq-default'.
  675.    In addition to the ability to ignore regions that match regular
  676. expressions, Ediff can be ordered to start skipping over certain
  677. "inessential" regions.  This is controlled by the following variable:
  678. `ediff-ignore-similar-regions'
  679.      If `t', causes Ediff to skip over difference regions that deemed
  680.      inessential, i.e., where the only differences are those in the
  681.      white space and newlines.
  682.    *Note:* In order for this feature to work, auto-refining of
  683. difference regions must be on, since otherwise Ediff won't know if there
  684. are fine differences between regions.  On devices where Emacs can
  685. display faces, auto-refining is a default, but it is not turned on by
  686. default on text-only terminals.  In that case, you must explicitly turn
  687. auto-refining on (such as, by typing `@').
  688.    *Reassurance:* If many inessential regions appear in a row, Ediff may
  689. take a long time to jump to the next region because it has to compute
  690. fine differences of all intermediate regions.  This delay does not
  691. indicate any problem.
  692. File: ediff,  Node: Highlighting Difference Regions,  Next: Narrowing,  Prev: Selective Browsing,  Up: Customization
  693. Highlighting Difference Regions
  694. ===============================
  695.    The following variables control the way Ediff highlights difference
  696. regions:
  697. `ediff-before-flag-bol'
  698. `ediff-after-flag-eol'
  699. `ediff-before-flag-mol'
  700. `ediff-after-flag-mol'
  701.      These variables hold strings that Ediff uses to mark the beginning
  702.      and the end of the differences found in files A, B, and C on
  703.      devices where Emacs cannot display faces. Ediff uses different
  704.      flags to highlight regions that begin/end at the beginning/end of
  705.      a line or in a middle of a line.
  706. `ediff-current-diff-face-A'
  707. `ediff-current-diff-face-B'
  708. `ediff-current-diff-face-C'
  709.      Ediff uses these faces to highlight current differences on devices
  710.      where Emacs can display faces.  These and subsequently described
  711.      faces can be set either in `.emacs' or in `.Xdefaults'. The X
  712.      resource for Ediff is `Ediff', *not* `emacs'. Please refer to
  713.      Emacs manual for the information on how to set X resources.
  714. `ediff-fine-diff-face-A'
  715. `ediff-fine-diff-face-B'
  716. `ediff-fine-diff-face-C'
  717.      Ediff uses these faces to show the fine differences between the
  718.      current differences regions in buffers A, B, and C, respectively.
  719. `ediff-even-diff-face-A'
  720. `ediff-even-diff-face-B'
  721. `ediff-even-diff-face-C'
  722. `ediff-odd-diff-face-A'
  723. `ediff-odd-diff-face-B'
  724. `ediff-odd-diff-face-C'
  725.      Non-current difference regions are displayed using these
  726.      alternating faces. The odd and the even faces are actually
  727.      identical on monochrome displays, because without colors options
  728.      are limited.  So, Ediff uses italics to highlight non-current
  729.      differences.
  730. `ediff-force-faces'
  731.      Ediff generally can detect when Emacs is running on a device where
  732.      it can use highlighting with faces. However, if it fails to
  733.      determine that faces can be used, the user can set this variable
  734.      to `t' to make sure that Ediff uses faces to highlight differences.
  735. `ediff-highlight-all-diffs'
  736.      Indicates whether--on a window system--Ediff should highlight
  737.      differences using inserted strings (as on a text-only terminal) or
  738.      using colors and highlighting.  Normally, Ediff highlights all
  739.      differences, but the selected difference is highlighted more
  740.      visibly.  One can cycle through various modes of highlighting by
  741.      typing `h'.  By default, Ediff starts in the mode where all
  742.      difference regions are highlighted.  If you prefer to start in the
  743.      mode where unselected differences are not highlighted, you should
  744.      set `ediff-highlight-all-diffs' to `nil'.  Type `h' to restore
  745.      highlighting of all differences.
  746.      Ediff lets you switch between the two modes of highlighting.  That
  747.      is, you can switch interactively from highlighting using faces to
  748.      highlighting using string flags, and back.  Of course, switching
  749.      has effect only under a windowing system.  On a text-only terminal
  750.      or in an xterm window, the only available option is highlighting
  751.      with strings.
  752. If you want to change the above variables, you must do it *before*
  753. Ediff is loaded.
  754.    There are two ways to change the default setting for highlighting
  755. faces: either change the variables, as shown here,
  756.      (setq ediff-current-diff-face-A 'bold-italic)
  757. or here,
  758.      (setq ediff-current-diff-face-A
  759.      (copy-face 'bold-italic 'ediff-current-diff-face-A))
  760. or modify the defaults selectively:
  761.      (add-hook 'ediff-load-hook
  762.                (function (lambda ()
  763.                            (set-face-foreground
  764.                              ediff-current-diff-face-B "blue")
  765.                            (set-face-background
  766.                              ediff-current-diff-face-B "red")
  767.                            (make-face-italic
  768.                              ediff-current-diff-face-B))))
  769.    You may also want to take a look at how the above faces are defined
  770. in the source code of Ediff.
  771.    *Note:* it is not recommended to use `internal-get-face' (or
  772. `get-face' in XEmacs) when defining Ediff's faces, since this may cause
  773. problems when there are several frames with different font sizes.
  774. Instead, use `copy-face' or `set/make-face-...' as shown above.
  775. File: ediff,  Node: Narrowing,  Next: Refinement of Difference Regions,  Prev: Highlighting Difference Regions,  Up: Customization
  776. Narrowing
  777. =========
  778.    If buffers being compared are narrowed at the time of invocation of
  779. Ediff, `ediff-buffers' will preserve the narrowing range.  However, if
  780. `ediff-files' is invoked on the files visited by these buffers, that
  781. widens the buffers, since this command is defined to compare the entire
  782. files.
  783.    Calling `ediff-regions-linewise' or `ediff-windows-linewise', or the
  784. corresponding `-wordwise' commands, narrows the buffers being compared
  785. (corresponding to the regions being compared).  The original accessible
  786. ranges are restored when you quit Ediff.  During the command, you can
  787. toggle this narrowing on and off with the `%' command.
  788.    These two variables control this narrowing behavior:
  789. `ediff-start-narrowed'
  790.      If `t', Ediff narrows the display to the appropriate range when it
  791.      is invoked with an `ediff-regions...' or `ediff-windows...'
  792.      command.  If `nil', these commands do not automatically narrow,
  793.      but you can still toggle narrowing on and off by typing `%'.
  794. `ediff-quit-widened'
  795.      Controls whether on quitting Ediff should restore the accessible
  796.      range that existed before the current invocation.
  797. File: ediff,  Node: Refinement of Difference Regions,  Next: Patch and Diff Programs,  Prev: Narrowing,  Up: Customization
  798. Refinement of Difference Regions
  799. ================================
  800.    Ediff has variables to control the way fine differences are
  801. highlighted.  This feature gives you control over the process of
  802. refinement.  Note that refinement ignores spaces, tabs, and newlines.
  803. `ediff-auto-refine'
  804.      This variable controls whether fine differences within regions are
  805.      highlighted automatically ("auto-refining").  The default is yes
  806.      (`on').
  807.      On a slow machine, automatic refinement may be painful.  In that
  808.      case, you can turn auto-refining on or off interactively by typing
  809.      `@'.  You can also turn off display of refining that has already
  810.      been done.
  811.      When auto-refining is off, fine differences are shown only for
  812.      regions for which these differences have been computed and saved
  813.      before.  If auto-refining and display of refining are both turned
  814.      off, fine differences are not shown at all.
  815.      Typing `*' computes and displays fine differences for the current
  816.      difference region, regardless of whether auto-refining is turned
  817.      on.
  818. `ediff-auto-refine-limit'
  819.      If auto-refining is on, this variable limits the size of the
  820.      regions to be auto-refined.  This guards against the possible
  821.      slowdown that may be caused by extraordinary large difference
  822.      regions.
  823.      You can always refine the current region by typing `*'.
  824. `ediff-forward-word-function'
  825.      This variable gives control over how fine differences are
  826.      computed.  The value must be a Lisp function that determines how
  827.      the current difference region should be split into words.
  828.      Fine differences are computed by first splitting the current
  829.      difference region into words and then passing this along to
  830.      `ediff-diff-program'. For the default
  831.      `ediff-forward-word-function' (which is `ediff-forward-word'), a
  832.      word is a string consisting of letters, `-', or `_'; a string of
  833.      punctuation symbols; a string of digits, or a string consisting of
  834.      symbols that are neither space, nor a letter.
  835.      This default behavior is controlled by four variables:
  836.      `ediff-word-1', ..., `ediff-word-4'. See the on-line documentation
  837.      for these variables and for the function `ediff-forward-word' for
  838.      an explanation of how to modify these variables.
  839.    Sometimes, when a region has too many differences between the
  840. variants, highlighting of fine differences is inconvenient, especially
  841. on color displays.  If that is the case, type `*' with a negative
  842. prefix argument.  This unhighlights fine differences for the current
  843. region.
  844.    To unhighlight fine differences in all difference regions, use the
  845. command `@'.  Repeated typing of this key cycles through three
  846. different states: auto-refining, no-auto-refining, and no-highlighting
  847. of fine differences.
  848.